home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-12-16 | 3.6 KB | 132 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: SLColor.cpp
- // Release Version: $ ODF 3 $
- //
- // Copyright: © 1993-1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #include "FWOS.hpp"
-
- #ifndef SLCOLOR_H
- #include "SLColor.h"
- #endif
-
- #ifdef FW_BUILD_MAC
- #pragma segment FW_Graphics
- #endif
-
- //========================================================================================
- // Color conversion functions
- //========================================================================================
-
- #ifdef FW_BUILD_WIN
-
- #if 0
-
- // The OS static library precompiles a header file which puts precompiled
- // debug info into FWRegEdt.obj. We need to force a reference to that file
- // from somewhere in this DLL.
-
- extern "C"
- {
- HRESULT WINAPI ODFRegisterServer();
- HRESULT WINAPI ODFUnregisterServer();
- }
-
- #ifdef FW_DEBUG
-
- short FW_gPartRegistryResourceID = -1;
- static HRESULT (WINAPI *registerFunc)() = ODFRegisterServer;
-
- #endif
-
- #endif
-
- //----------------------------------------------------------------------------------------
- // FW_WinRGBQuadToColor
- //----------------------------------------------------------------------------------------
-
- FW_SColor SL_API
- FW_WinRGBQuadToColor(const RGBQUAD* rgbQuad)
- {
- FW_SColor color;
- FW_PrivSetRGB(color, rgbQuad->rgbRed, rgbQuad->rgbGreen, rgbQuad->rgbBlue);
- return color;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_WinRGBTripleToColor
- //----------------------------------------------------------------------------------------
-
- FW_SColor SL_API
- FW_WinRGBTripleToColor(const RGBTRIPLE* rgbTriple)
- {
- FW_SColor color;
- FW_PrivSetRGB(color, rgbTriple->rgbtRed, rgbTriple->rgbtGreen, rgbTriple->rgbtBlue);
- return color;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_WinColorToRGBQuad
- //----------------------------------------------------------------------------------------
-
- void SL_API
- FW_WinColorToRGBQuad(FW_SColor rgb, RGBQUAD* rgbQuad)
- {
- rgbQuad->rgbRed = FW_PrivRGB_R(rgb);
- rgbQuad->rgbGreen = FW_PrivRGB_G(rgb);
- rgbQuad->rgbBlue = FW_PrivRGB_B(rgb);
- rgbQuad->rgbReserved = 0;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_WinColorRGBTriple
- //----------------------------------------------------------------------------------------
-
- void SL_API
- FW_WinColorRGBTriple(FW_SColor rgb, RGBTRIPLE* rgbTriple)
- {
- rgbTriple->rgbtRed = FW_PrivRGB_R(rgb);
- rgbTriple->rgbtGreen = FW_PrivRGB_G(rgb);
- rgbTriple->rgbtBlue = FW_PrivRGB_B(rgb);
- }
-
- #endif
-
- #ifdef FW_BUILD_MAC
-
- //----------------------------------------------------------------------------------------
- // FW_MacRGBToColor
- //----------------------------------------------------------------------------------------
-
- FW_SColor SL_API
- FW_MacRGBToColor(const RGBColor* rgbColor)
- {
- // No try block necessary - Do not throw
- FW_SColor color;
- FW_PrivSetRGB(color, rgbColor->red >> 8, rgbColor->green >> 8, rgbColor->blue >> 8);
- return color;
- }
-
- //----------------------------------------------------------------------------------------
- // FW_MacColorToRGB
- //----------------------------------------------------------------------------------------
-
- void SL_API
- FW_MacColorToRGB(FW_SColor rgb, RGBColor* rgbColor)
- {
- // No try block necessary - Do not throw
- rgbColor->red = FW_PrivRGB_R(rgb);
- rgbColor->red |= rgbColor->red << 8;
-
- rgbColor->green = FW_PrivRGB_G(rgb);
- rgbColor->green |= rgbColor->green << 8;
-
- rgbColor->blue = FW_PrivRGB_B(rgb);
- rgbColor->blue |= rgbColor->blue << 8;
- }
-
- #endif
-